package com.pangzhao.prize.commons.db.mapper;

import com.pangzhao.prize.commons.db.entity.TaskBase;
import com.pangzhao.prize.commons.db.entity.TaskBaseExample;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface TaskBaseMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    long countByExample(TaskBaseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    int deleteByExample(TaskBaseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    @Delete({
        "delete from task_base",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    @Insert({
        "insert into task_base (name, target_type, ",
        "cron, last_run_result, ",
        "last_run_time, last_run_time_cost, ",
        "status, create_user_id, ",
        "create_time, target_value)",
        "values (#{name,jdbcType=VARCHAR}, #{targetType,jdbcType=INTEGER}, ",
        "#{cron,jdbcType=VARCHAR}, #{lastRunResult,jdbcType=VARCHAR}, ",
        "#{lastRunTime,jdbcType=TIMESTAMP}, #{lastRunTimeCost,jdbcType=INTEGER}, ",
        "#{status,jdbcType=INTEGER}, #{createUserId,jdbcType=INTEGER}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{targetValue,jdbcType=LONGVARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(TaskBase record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    int insertSelective(TaskBase record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    List<TaskBase> selectByExampleWithBLOBs(TaskBaseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    List<TaskBase> selectByExample(TaskBaseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, name, target_type, cron, last_run_result, last_run_time, last_run_time_cost, ",
        "status, create_user_id, create_time, target_value",
        "from task_base",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.pangzhao.prize.commons.db.mapper.TaskBaseMapper.ResultMapWithBLOBs")
    TaskBase selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") TaskBase record, @Param("example") TaskBaseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    int updateByExampleWithBLOBs(@Param("record") TaskBase record, @Param("example") TaskBaseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") TaskBase record, @Param("example") TaskBaseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(TaskBase record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    @Update({
        "update task_base",
        "set name = #{name,jdbcType=VARCHAR},",
          "target_type = #{targetType,jdbcType=INTEGER},",
          "cron = #{cron,jdbcType=VARCHAR},",
          "last_run_result = #{lastRunResult,jdbcType=VARCHAR},",
          "last_run_time = #{lastRunTime,jdbcType=TIMESTAMP},",
          "last_run_time_cost = #{lastRunTimeCost,jdbcType=INTEGER},",
          "status = #{status,jdbcType=INTEGER},",
          "create_user_id = #{createUserId,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "target_value = #{targetValue,jdbcType=LONGVARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKeyWithBLOBs(TaskBase record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table task_base
     *
     * @mbg.generated
     */
    @Update({
        "update task_base",
        "set name = #{name,jdbcType=VARCHAR},",
          "target_type = #{targetType,jdbcType=INTEGER},",
          "cron = #{cron,jdbcType=VARCHAR},",
          "last_run_result = #{lastRunResult,jdbcType=VARCHAR},",
          "last_run_time = #{lastRunTime,jdbcType=TIMESTAMP},",
          "last_run_time_cost = #{lastRunTimeCost,jdbcType=INTEGER},",
          "status = #{status,jdbcType=INTEGER},",
          "create_user_id = #{createUserId,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TaskBase record);
}